package com.huazi.www.drug.drugy.util;

import java.util.List;

/**
 * 分布实体类
 * 五个属性
 * 总启记录数  总页数  每页显示的条数  页码  集体
 */
//泛型类可以成功任何类型的类
public class Page<T> {
    //总记录数  该数为已知数
    private Integer totalCount;
    //总页数   该数通过  总记录数/每面的显示条数  可得
    private Integer totalPage;
    //每页显示的条数  该数为已知数
    private Integer pageSize;
    //页码
    private Integer currentPage;

    //每页显示的数据的集合
    private List<T> list;

    public Integer getTotalCount() {

        return totalCount;
    }

    public void setTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
        //赋值的同时把总页数算出来
        this.totalPage = this.totalCount % this.pageSize == 0 ? this.totalCount / this.pageSize : this.totalCount / this.pageSize + 1;
    }

    public Integer getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(Integer totalPage) {
        this.totalPage = totalPage;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(Integer currentPage) {
        this.currentPage = currentPage;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }
}
